package com.jine.boot4.country.controller;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.jine.boot4.country.model.Country;
import com.jine.boot4.country.service.CountryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("country")
public class CountryController {

    @Autowired
    private CountryService countryService;

    @ResponseBody
    @GetMapping("/page")
    public Page<Country> pageList(int pageSize,int limit){
        Page<Country> page = PageHelper.startPage(pageSize,limit);
        List<Country> list =this.countryService.findAll();
        return page;
    }


}
